package com.droidbank;


import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class DroidBankActivity extends TabActivity {

	//---------------------------------------------------------
	
	//start
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_layout);

        Resources res = getResources(); // Resource object to get Drawables
        TabHost tabHost = getTabHost();  // The activity TabHost
        TabHost.TabSpec spec;  
        Intent intent;  

        // Create an Intent to launch an Activity for the tab (to be reused)
        intent = new Intent().setClass(this, AccountsActivity.class);
        spec = tabHost.newTabSpec("accounts").setIndicator("Accounts",
                          res.getDrawable(R.drawable.ic_tab_account))
                      .setContent(intent);
        tabHost.addTab(spec);
        
        intent = new Intent().setClass(this, AddExpenseActivity.class);
        spec = tabHost.newTabSpec("add_expense").setIndicator("Add Expense",
                          res.getDrawable(R.drawable.ic_tab_add))
                      .setContent(intent);
        tabHost.addTab(spec);
        
        
      intent = new Intent().setClass(this, TransferActivity.class);
      spec = tabHost.newTabSpec("transfer").setIndicator("Transfer",
                        res.getDrawable(R.drawable.ic_tab_transfer))
                    .setContent(intent);
      tabHost.addTab(spec);
        
        
//        tabHost.setOnTabChangedListener(new OnTabChangeListener()
//        {
//        	public void onTabChanged(String tabId)
//            	{
//        		getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
//            	}
//        });      
        
        tabHost.setCurrentTab(0);
    }
	
	//destroyed make backup
	protected void onDestroy(){
		super.onDestroy();
		
		//Log.d("DEBUG", "saving backup");
		//((DataModel)getApplication()).saveFile(DataModel.FILE_NAME_BACKUP, true,false);
	}
	
	
}